package app.agent.tests

import app.agent.tests.TestsLocator._
import app.server.{TestsResponse, ServicesResponse}
import im.mange.jetboot.{Renderable, Html}
import Html._
import app.comet.Subscriber

//TODO: potentially this is shareable?
case class TestsContentAgent(subscriber: Subscriber) extends Renderable {
  private val holder = div(testsContentAgent).classes("hidden")

  override def render = holder.render

  def onHide = holder.empty & holder.hide

  //TODO: inline TestsContentPresentation
  def onShowResponse(response: TestsResponse) = holder.show & holder.fill(TestsContentPresentation(response.tests, subscriber))
}